from pymongo import MongoClient
from app.core.config import MONGODB_URI, DATABASE_NAME

client = MongoClient(MONGODB_URI)
db = client[DATABASE_NAME]

class GeneratedCommentCRUD:
    @staticmethod
    def create_comment(comment_data):
        return db.generated_comment.insert_one(comment_data)

    @staticmethod
    def get_comment_by_id(comment_id):
        return db.generated_comment.find_one({'_id': comment_id})

    @staticmethod
    def update_comment(comment_id, update_data):
        return db.generated_comment.update_one({'_id': comment_id}, {'$set': update_data})

    @staticmethod
    def delete_comment(comment_id):
        return db.generated_comment.delete_one({'_id': comment_id})
